Mega Code Archive

Categories
1) Android
2) ASP.Net
3) ASP.Net Tutorial
4) C
5) C Tutorial
6) C#
7) C# Book
8) C# by API
9) C# Tutorial
10) C++
11) C++ Tutorial
12) Delphi
13) Flash ActionScript
14) Flex
15) Java
16) Java Book
17) Java by API
18) Java Tutorial
19) JavaScript DHTML
20) JavaScript Reference
21) JavaScript Tutorial
22) MSOfficeExcel 2007 Tutorial
23) MSOfficePowerPoint 2007 Tutorial
24) MSOfficeWord 2007 Tutorial
25) MSSQL
26) MSSQL Tutorial
27) MySQL
28) MySQL Tutorial
29) Oracle PLSQL
30) Oracle PLSQL Tutorial
31) Perl
32) Php
33) PostgreSQL
34) Python
35) Python Tutorial
36) Ruby
37) Silverlight
38) VB.Net
39) VB.Net by API
40) VB.Net Tutorial
41) Visual C++ .NET
42) VisualBasic Script
43) XML
44) XML Tutorial
 
Ruby
1) Active Record
2) Array
3) CGI
4) Class
5) Collections
6) Database
7) Date
8) Design Patterns
9) Development
10) File Directory
11) GUI
12) Hash
13) Language Basics
14) Method
15) Network
16) Number
17) Rails
18) Range
19) Reflection
20) Statement
21) String
22) Threads
23) Time
24) Tk
25) Unit Test
26) Windows Platform
27) XML
Array
1) A basic array with []
2) A quick way of printing out an entire array
3) Access the First and Last Elements of the Array
4) Access the last element in the array
5) Accessing Elements
6) Add a new method to Array class
7) Add method to Array class to convert an array to a hash
8) Add new operator for Array
9) Add shuffle method to Array class
10) Add subset and superset operator for Array
11) Add your method to system data type
12) Apply the sort (or sort!, for in-place changes)
13) ArgumentError
14) Array Addition and Concatenation
15) Array cartesian
16) Array delete takes a block
17) Array initialized by copying
18) Array map with regular expression
19) Array new creates an empty array
20) Array new creates an empty array, represented as [], named months
21) Array new(2) creates an array with two nil values
22) Array new(5, A) fills an array with five a
23) Array Pack Directives
24) Array Subtraction and Difference
25) Array with %w
26) Array with Array new
27) Array[1, 2] references two array elements, starting with the element at index 1, and this statement replaces two elements in the arr
28) Arrays and Blocks
29) Arrays dont need to be set up with predefined entries or have elements allocated manually
30) As with +, you can concatenate one array onto another with concat
31) Assign an object (such as a string) to each element in the array
32) Assign block value to a variable in array each method
33) Assign string value to an integer array
34) Assigning a value to array[3, 0] did not replace any element in the array; it inserted a new element starting at index 3 instead
35) Binary conversion with pack See also String unpack
36) Blow Your Stack
37) Both first and last take integer arguments, indicating the number of elements to return
38) Building Up a Hash Using Injection
39) Call uniq to remove the duplications
40) Change array elements with collect!
41) Change array elements with map!
42) Change character case of an element
43) Check an Array for a Certain Item
44) Check for an Empty Array
45) Collect with code block
46) Combine three arrays to create multi-dimensional array
47) Compact and clear
48) Compare arrays is with = (spaceship operator)
49) Comparing Arrays
50) Comparison
51) Computing Set Operations on Arrays
52) Concatenate is with the method
53) Concatenation with the + operator
54) Convert a two-dimensional array to a hash
55) Convert array to a hash
56) Convert array to a set
57) Convert array to hash
58) Count with block
59) Create an array of hashes
60) Creates a array with the Array classs new method
61) Creating an Array with a Block
62) Creating Arrays with the new class method
63) Cycle an array
64) Define an array of strings is with the %w notation
65) Delete method removes a matching object from an array, returning the deleted object if found
66) Delete_at can delete an element based on its index
67) Difference (-) creates a new array, removing elements that appear in both arrays
68) Drop leading nils
69) Each from both sides
70) Each method goes through each element of the array and passes it as a parameter to the code block you supply
71) Each with block which has if statement
72) Each with index and block
73) Elements can be accessed by their index (their position within the array)
74) Eql returns true if the objects are the same or if their content is the same
75) Equality
76) Examples of the methods provided by Enumerable
77) Exclude a list of natrual number
78) Extends array comparsion method
79) Extract array in place
80) Fill an array
81) Fill an array of hashes
82) Find index in an array
83) Find_all with block logic
84) Flatten a multi-demensional array
85) Freeze an array
86) Get array element by using grep
87) Get the bottom 5 elements
88) Get the first and last elements of an array is with the first and last methods
89) Get the flip side with index
90) Get the max value in an array
91) Get the top 5 elements
92) Getting the n Smallest Items of an Array
93) Grep [^g]
94) Grep numbers
95) Group programming languages by their first letter
96) Have an array that contains objects from different classes, not all just one type
97) Identify the Array and Hash of Customers
98) If you have a collection, such as an array or a range, you can also use the Ruby each iterator to create a loop
99) If you pass a numeric parameter to first or last, youll get that number of items from the start or the end of the array
100) If you submit a set of strings, Array accepts them as a single, concatenated element
101) In Ruby the first index is the start location and the second holds the count
102) Include with parenthesis
103) Inject a two-dimensional array to set
104) Insert Elements
105) Instead of [], you can also use the slice method, another alias
106) Is an element in this array
107) Iterate all possible 2-element subarrays (order matters)
108) Iterate all possible 2-element subsets (order does not matter)
109) Iterating Over an Array with each
110) Join all the elements together into one big string by calling the join method on the array
111) Join method can take an optional parameter thats placed between each element in the resulting string
112) LocalJumpError
113) Loop through an array until empty
114) Loop through each_index
115) Map to uppercase
116) Max_by with block
117) Minus from one array
118) Mix up an array
119) Object array
120) Override array method
121) Pack and unpack an array
122) Push an array to another array
123) Push integer and string to the same array
124) Ream out an array with clear
125) Reject the even ones
126) Reject with block logic
127) Remove entries from an array one by one
128) Replace an array
129) Replacing subarrays with []=
130) Resequence the array
131) Return the Cartesian product of the two sets
132) Return the size of an array with either the size or length method
133) Reverse each with array
134) Reverse from backend with reverse_each
135) Reverse in place
136) Reverse the Order of the Arrays Elements
137) Ruby can do several set operations on arrays
138) Set multiple elements at the same time
139) Set operation based on array
140) Set operation on array constant
141) Set permutation for Array
142) Set the size of an array (the number of elements in an array)
143) Several Array literals
144) Size and elements in a two-dimensional array
145) Slcie with range parameter
146) Slice with exclusive range parameter
147) Slice with one parameters
148) Slice with two parameters
149) Sort object array by object attribute
150) Specify where to start in the array and how many elements you want
151) Start with p
152) Step with array
153) Store text strings as well as numbers in arrays
154) Strip values from array
155) Stripping Duplicate Elements from an Array
156) Sum an array with inject
157) Sum of word lengths
158) Take until nil
159) Takes a range as an argument to create an array of digits
160) The first element in the array corresponds to array index 0, not 1
161) The last element in the array is -1, the previous one -2, the previous one -3
162) The map method returns a new array instead of a string
163) The reverse method reverses the order of the elements in an array, returning a new array of elements, reversed
164) Three dimensional array
165) To change an element, you can simply assign it a new value or manipulate it
166) To change three of the elements to have German rather than English spelling
167) To create an array, you use the [] operator
168) To inspect the array
169) Transpose a multi-demensional array
170) Transpose method
171) TypeError
172) Union () joins two arrays together, removing duplicates
173) Unique Elements
174) Unshift prepends objects (one or more) to an array
175) Use a range
176) Use a variable (or a constant) as an array index
177) Use hash to count elements in an array
178) Use negative array indices in Ruby
179) Use ranges as array indices to select multiple elements at the same time
180) Use the arrays built-in length method, which returns the number of elements in the array
181) Use the at method
182) Use the compact method, which removes all nils from an array
183) Use until and array element to loop through an array
184) Use while and array index to get element from an array
185) Using shift and unshift
186) Using the clone method is the actual way of copying between arrays
187) Using Two Array Indices
188) What is a multi-dimensional Arrays
189) Which of these numbers are less than the target
190) With -1, you access the last element in an array by looping back around with a negative number
191) With arrays, is the operator for pushing an item onto the end of an array
192) With start and length parameters
193) You can add things to the end of the array by pushing data into it
194) You can convert an array on the fly using the collect method